#include <stdio.h>
#include <math.h>
#include <string.h>

char* Int2String(int num, char *str) {
    sprintf(str, "%d", num);
    return str;
}

int main() {
    int n_page;
    while (scanf("%d", &n_page) && n_page != 0) {
        int n_paper = ceil(n_page/4.0f);
        // printf("%d\n", n_paper);
        int page_list[n_paper*4];
        memset(page_list, 0, sizeof(page_list));
        int page_now = 1;
        for (int i = 1; i < n_page+1; i++) {
            page_list[page_now] = i;
            if ((page_now % 4 == 1) || (page_now == n_paper*4-2)) {
                page_now += 1;
            } else if (page_now % 4 == 2) {
                page_now += 3;
            } else if (page_now % 4 == 0) {
                page_now -= 1;
            } else if (page_now % 4 == 3) {
                page_now -= 3;
            }
        }
        printf("Printing order for %d pages:\n", n_page);
        
        int sheet_now = 1;
        char page_write1[16] = {0}, page_write2[16] = {0};
        if (n_page == 1) {
            printf("Sheet 1, front: Blank, 1\n");
        }
        else {
            for (int i = 0; i < n_paper*2; i++) {
                if (page_list[2*i] != 0) {
                    Int2String(page_list[2*i], page_write1);
                }
                else {
                    snprintf(page_write1, sizeof(page_write1), "Blank");
                }
                if (page_list[2*i+1] != 0) {
                    Int2String(page_list[2*i+1], page_write2);
                }
                else {
                    snprintf(page_write2, sizeof(page_write2), "Blank");
                }

                char sheet_side[6];
                if (i%2 == 1) {
                    snprintf(sheet_side, sizeof(sheet_side), "back ");
                }
                else if (i%2 == 0) {
                    snprintf(sheet_side, sizeof(sheet_side), "front");
                }
                printf("Sheet %d, %s: %s, %s\n", sheet_now, sheet_side, page_write1, page_write2);
                if (i%2 == 1) {
                    sheet_now++;
                }
            }
            // int pagelist_length = sizeof(page_list) / sizeof(page_list[0]);
            // for (size_t i = 0; i < pagelist_length; i++) {
            //     if (i%2 == 0) printf("\n");
            //     printf("%d ", page_list[i]);
            // }
        }
        printf("\n");
    }
    
    return 0;
}

